import { createStore } from 'vuex'
import { result } from '@/utils/tools'
import { Auth } from '@/service'
import persistedState from 'vuex-persistedstate'
export default createStore({
  state: {
    // 身份记录
    role: null,
    myUserId:''
  },
  getters: {},
  mutations: {
    setRoleInfo(state, roleInfo) {
      state.role = Object.assign({}, roleInfo)
    },
    setMyUserId(state, userId) {
      state.myUserId = userId
    }
  },
  actions: {
    // async getRoleInfo(store) {
    //   const res = await Auth.getUserInfo()
    //   result(res).success(({ data }) => {
    //     store.commit('setStudentInfo', data)
    //   })
    // },
  },
  modules: {},
  plugins: [persistedState({ storage: window.sessionStorage })],
})
